Add --allow-build flag & tool.pywrangler setting#144
Conversation
By default we pass `--no-build` because building a binary Pyodide wheel will fail in a confusing way. This makes it annoying to work with local packages though. This adds a `--allow-build` setting to override.
| source = pkg.get(key) | ||
| if not isinstance(source, dict): | ||
| return False | ||
| # A local reference has a `path`` |
There was a problem hiding this comment.
| # A local reference has a `path`` | |
| # A local reference has a `path` |
| When *allow_build* is True, ``--no-build`` is omitted so source | ||
| distributions and local directory sources may be built. Building a binary | ||
| extension in this way will fail in a confusing way. |
There was a problem hiding this comment.
This comment already exists inside _compile_lockfile so I don't think it has to be duplicated here.
| # --------------------------------------------------------------------------- | ||
| # Flag / config propagation into sync() | ||
| # --------------------------------------------------------------------------- |
There was a problem hiding this comment.
I think these tests doesn't add much value. Also, these tests are quite easy to break whenever we update internal logics or parameters.
|
|
||
|
|
||
| @pytest.mark.parametrize("allow_build", [True, False]) | ||
| def test_compile_lockfile_no_build_toggle(tmp_path, allow_build): |
There was a problem hiding this comment.
This too. We are adding too many mocks just to test
if not allow_build:
args.append("--no-build")which is pretty obvious.
Of course, this kind of test would be great to prevent any kind of regression we make by accident later, but I think adding 4 mock functions just to test this is a code smell. We should our refactor our logic to make the test easier.
There was a problem hiding this comment.
This is missing a real, e2e test.
By default we pass
--no-buildbecause building a binary Pyodide wheel will fail in a confusing way. This makes it annoying to work with local packages though. This adds a--allow-buildsetting to override.